import java.lang.reflect.Array;
import java.util.Arrays;

/**
 * Created with Intellij IDEA.
 * Description:
 * User:Lenovo
 * Date:2024-12-08
 * Time:15:09
 */
class MyArray<T>{
    T[] array;

    public MyArray() {
    }
    public MyArray(Class<T> clazz,int size){
        array = (T[])Array.newInstance(clazz,size);
    }

    public void setArray(int index,T value) {
        this.array[index] = value;
    }

    public T[] getArray() {
        return array;
    }
    public T getArray(int index){
        return array[index];
    }

    @Override
    public String toString() {
        return "MyArray{" +
                "array=" + Arrays.toString(array) +
                '}';
    }
}
public class Text {
    public static void main(String[] args) {
        MyArray<Integer> array = new MyArray<>(Integer.class,10);
        array.setArray(2,10);
        System.out.println(array.getArray());
        Integer a = array.getArray(2);
        System.out.println(a);
    }
}
